package s15.ch18.ex2;

public class MyThread implements Runnable {

	private String name;
	private Thread thread;

	public MyThread(String name) {
		this.setName(name);
		this.setThread(new Thread(this, getName()));
	}

	public void run() {
		System.out.println("I am " + getName());
		
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Thread getThread() {
		return thread;
	}

	public void setThread(Thread thread) {
		this.thread = thread;
	}

	public void start() {
		getThread().start();
	}

}
